<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <style>
    #father {
      width: 200px;
      height: 200px;
      position: relative;
      background-color: #ccc;
    }

    #child {
      width: 100px;
      height: 100px;
      background-color: gold;
      position: absolute;
      left: 50%;
      top: 50%;
      margin-top: -50px;
      margin-left: -50px;
    }
  </style>
</head>

<body>
  <div id="father">
    <div id="child"></div>
  </div>

  <hr>

  <!-- font-size: 20px;是有继承性能 -->
  <div style="font-size: 20px;">
    <p style="text-indent: 2em; font-size: 40px;">我是一个P标签</p>
  </div>
</body>

</html>